This invention is directed to a system and method for allocating random access memory. In particular, this invention is directed to a system and method for the sub-allocation of blocks of shared system random access memory. More particularly, the present invention is directed to a system and method for acquiring segments of shared memory from a system and then allocating blocks of shared memory from the acquired segments.
The use of shared memory for inter-process communications is commonly used in many data processing environments. Shared memory enables one or more processes to communicate via a memory that appears in all of their virtual address spaces. In certain operating systems, such as Linux, processes requesting the use of shared memory do not always get the exact size requested via the system calls. The allocated amount of shared memory is typically the requested amount rounded up to a multiple of PAGE_SIZE, thus when 100 bytes of shared memory is requested, 4096 bytes of shared memory is allocated by the system. When 5000 bytes of shared memory is requested, the system returns a multiple of PAGE_SIZE, thus since the requested amount is greater than the amount of a single PAGE_SIZE, the system rounds up and 8192 bytes of shared memory are allocated. The foregoing typical allocation of shared memory results in large, wasted portions of the system memory.
Thus there is a need for a system and method for sub-allocating shared system random access memory.